import axios from '@/utils/axios'

const prefix = 'literature/tag'

export const getTag = (id: string): Promise<ApiResult<LiteratureTagPo>> => {
  return axios.get(`${prefix}/${id}`)
}

export const getTagPage = (
  pagination: Pagination,
  params: LiteratureTagPo
): Promise<ApiResult<Page<LiteratureTagPo>>> => {
  return axios.get(`${prefix}/page/${pagination.page}/${pagination.pageSize}`, { params })
}

export const postOrPutTag = (data: LiteratureTagPo): Promise<ApiResult<null>> => {
  return axios.post(`${prefix}`, data)
}

export const deleteTag = (id: string): Promise<ApiResult<null>> => {
  return axios.delete(`${prefix}/${id}`)
}
